Skip to content

Port to PyQt6#3876

Closed
bgermann wants to merge 4 commits intoLinuxCNC:masterfrom
bgermann:pyqt6
Closed

Port to PyQt6#3876
bgermann wants to merge 4 commits intoLinuxCNC:masterfrom
bgermann:pyqt6

Conversation

@bgermann
Copy link

This is a completely mechanical conversion from PyQt5 to PyQt6. This is not tested to run successfully yet.

Drop the optional popplerqt5/python3-poppler-qt5 dependency and the
associated LIB_BAD guard. Use QPdfDocument from PyQt6.QtPdf instead,
which ships as part of PyQt6 itself.

Rendering now uses QPdfDocumentRenderOptions with Antialiasing and
TextAntialiasing flags set, preserving the render quality of the
original poppler-based code.

Other PyQt6 migration changes:
- app.exec_() replaced with app.exec()
- pageCount()/pagePointSize()/render() replace
  numPages()/page()/renderToImage()
@Sigma1912
Copy link
Contributor

This is not tested to run successfully yet.

In that case you might want to mark this PR as 'Draft''

@snowgoer540
Copy link
Contributor

I am curious, did you write this, or did a LLM write this for you?

I am running into several issues here.

  1. Creating a .diff of this pull request fails to apply.

error: patch failed: configs/sim/woodpecker/compensate.py:21
error: configs/sim/woodpecker/compensate.py: patch does not apply

I removed the changes to compensate.py from the diff and the rest applies.

  1. python3-pyqt6.qtwebkit does not exist. At best it's python3-pyqt6-qtwebengine. The rest seemed to install.
  2. Trying to run qtplasmac, I run into:
    ImportError: cannot import name 'Q_ENUM' from 'PyQt6.QtCore' (/usr/lib/python3/dist-packages/PyQt6/QtCore.abi3.so)

So I tried:

from PyQt6.QtCore import QEnum as Q_ENUM

That failed and further research tells me that QEnum was not included into pyqt6 until later (6.5+) versions.

I am currently running Debian 12 - Bookworm on this VM. PyQt6.QtCore version tops out at 6.4.2.

I am not sure if that stops your efforts, LinuxCNC is notoriously bad at drawing a line in the sand for supported Debian distros, but I think Boomworm is still very much supported.

Obviously there are ways around all of this, but it's going to be quite an effort I think.

What are you hoping to gain in the shift from pyqt5 to pyqt6?

@bgermann bgermann marked this pull request as draft March 23, 2026 14:43
@andypugh
Copy link
Collaborator

I am not sure if that stops your efforts, LinuxCNC is notoriously bad at drawing a line in the sand for supported Debian distros, but I think Boomworm is still very much supported.

Here is the sand, with some lines in it:

http://wiki.linuxcnc.org/cgi-bin/wiki.pl?MinimumSoftwareVersions

@snowgoer540
Copy link
Contributor

Here is the sand, with some lines in it:

Thanks Andy. Admittedly, I didn't know this existed. If I read it right, looks like Master min is Debian 12 - Bookworm.

@bgermann
Copy link
Author

Yes, I have used a LLM, which is why the QVariant type is not dealt with in a proper manner.
Basically, I want to provide a way for this to keep the PDF functionality with python-poppler-qt5 gone from forky. I took this as an opportunity to upgrade to PyQt6 but as you want to keep bookworm support, it is probably a better idea to implement the following: Use QtPy to support both PyQt5 and PyQt6 (and PySide6 if you want). Keep the poppler-qt5 support for Qt5 and use QtPdf for Qt6. With this, Debian unstable/forky can move to PyQt6 and drop poppler-qt5 while you can support bookworm.

This approach will also make the diff tiny because the QtPy API is PyQt5-based, so basically only the imports change.

@snowgoer540
Copy link
Contributor

Yes, I have used a LLM, which is why the QVariant type is not dealt with in a proper manner. Basically, I want to provide a way for this to keep the PDF functionality with python-poppler-qt5 gone from forky. I took this as an opportunity to upgrade to PyQt6 but as you want to keep bookworm support, it is probably a better idea to implement the following: Use QtPy to support both PyQt5 and PyQt6 (and PySide6 if you want). Keep the poppler-qt5 support for Qt5 and use QtPdf for Qt6. With this, Debian unstable/forky can move to PyQt6 and drop poppler-qt5 while you can support bookworm.

This approach will also make the diff tiny because the QtPy API is PyQt5-based, so basically only the imports change.

Ok, I understand the situation a bit better now.

@c-morley and I are the two developers actively working on GUIs that depend on pyqt5. Hopefully Chris will weigh in here, but I think it best to do as you suggested, that makes testing for that specific case pretty easy and allows you to move forward with dropping poppler from Forky. It also gives us some time to work on porting our GUIs over to pyqt6, since it seems like that's coming sooner rather than later.

@c-morley
Copy link
Collaborator

I thank you for looking at this issue - PyQy6 was on my agenda.
I was hoping linuxcnc 210 would be released soon then switch to PyQt6.
Otherwise some sort of automatic qt5/6 mechanism would be needed.
I'll have to look at Qtpy in more depth.

@bgermann
Copy link
Author

Closing this in favour of #3881

@bgermann bgermann closed this Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants